- Recap:

non-static instance variables vs static instance variables

a. non-static instance variable: 

class Die {
	private int faceValue;

}

RollingDice {
	main(String[] args) {
		Die die1 = new Die();
		Die die2 = new Die();
	}

}

Die die1 = new Die(); // die1 is a first instance of the class called Die
die1: faceValue

Die die2 = new Die(); // die2 is a second instance of the class called Die
die2: faceValue

non-static instance variables: number of copies created = number of instances that you create

b. static instance variables

Slogan {
	private String phrase;
	private static int count = 0;

	public Slogan(String phrase) {
		this.phrase = phrase;
		count++;
	}

	public static int getCount() {
		return count;
	}
}

count is a static instance variable ===> Only one copy of that instance would be created and 
that copy is shared among all the instances of the class

Slogan slg1 = new Slogan("Just do it"); 
Slogan slg2 = new Slogan("Live free or die");

There will be only one copy of the variable called count and it is accessible by all Slogan objects. 

methods		static		non-static
variables
static		Yes		Yes			

non-static	No		Yes		


Driver {
	public static void main(String[] args) {


	}

	private static supporting_method ---> That supporting method will have to be static

}

- Class relationships: 
Design patterns

a. Dependency (uses); b. Inheritance (is a): class-based inheritance and interface-based; 
c. Aggregation (has a)

Dependency: 
Class A (for example RollingDice) is dependent on Class B (for instance Die) if one or more methods 
of Class A is/are using one or more methods of Class B

RollingDice {
	main(String[] args) {
		...
		die1.roll()
		die1.getFaceValue()

	}

}

RollingDice is dependent on Die class. 

Self-dependency case: 
A class is said to be self-dependent, if one object of the class can interact with 
another object of the same class using a method defined in this class. 

String str1, str2; // Created properly

str1.concat(str2) ===> String is an example of a self-dependent class

Application#1: RationalNumber.java and RationalNumberDriver.java

Rational number is a fraction of two int values
1 / 2, 1/4, etc...

r1.add(r2)
r1.multiply(r2)
r1.subtract(r2)
r1.divide(r2)

Finding GCD of two numbers: 
3		7
2		4
1		1

- Method decomposition:

Pig Latin Translator

happy enough
appyhay	enoughyay





















